<?php
/**
 * 描述：资讯-观察首页。
 * @final
 */
final class Exec_News_Observe_Index extends Exec
{
    public function Get()
    {
        #关键词
        $data=DB::GetRows('select * from news_keywords order by Datetime desc');
        View::Assign('News_Keywords',$data);

        #获取数据-最新评论
        $data=DB::GetRows('select * from news where SubclassID='.DAO_NewsClass::OBSERVE_COMMENT_ID.' and M_IsDelete=FALSE order by ID desc limit 0,5');
        foreach($data as &$row)
        {
            if($row['Thumbnail']){
				$row['Thumbnail']=config::PATH_RELATIVE_ATTACHMENT_NEWS.'/'.$row['Thumbnail'];
			}
        }
        View::Assign('News_Subclass_ObserveComment_ID',DAO_NewsClass::OBSERVE_COMMENT_ID);
        View::Assign('News_ObserveComment',$data);

        #获取数据-热点排行
        View::Assign('News_Ranking',DAO_News::Ranking());


        #获取数据-读者留言
        $data=DB::GetRows('select * from news where SubclassID='.DAO_NewsClass::OBSERVE_MESSAGE_ID.' and M_IsDelete=FALSE order by ID desc limit 0,9');
        foreach($data as &$row)
        {
            if((time()-strtotime($row['Datetime']))/3600/24<3)
                $row['IsNew']='TRUE';
            else
                $row['IsNew']='FALSE';
        }
        View::Assign('News_Subclass_ObserveMessage_ID',DAO_NewsClass::OBSERVE_MESSAGE_ID);
        View::Assign('News_ObserveMessage',$data);

        #获取数据-访谈观点
        $data=DB::GetRows('select * from news where SubclassID='.DAO_NewsClass::OBSERVE_INTERVIEW_ID.' and M_IsDelete=FALSE order by ID desc limit 0,9');
        foreach($data as &$row)
        {
            if((time()-strtotime($row['Datetime']))/3600/24<3)
                $row['IsNew']='TRUE';
            else
                $row['IsNew']='FALSE';
        }
        View::Assign('News_Subclass_ObserveInterview_ID',DAO_NewsClass::OBSERVE_INTERVIEW_ID);
        View::Assign('News_ObserveInterview',$data);

        #渲染模板
        View::Display('news/observe/index.tpl');
    }
}
?>